/// 登录参数
class LoginDto {
  /// 用户名
  final String userName;
  /// 密码
  final String password;
  /// 系统代码：1-客户端 2-平台端 3-核销代理端 4-财务代理端
  final int systemCode;
  /// 登录请求来源：1-Android 2-iOS 3-web，systemCode为1时不能为空，后台管理系统忽略此参数
  final int? from;
  /// 设备token：from为1或2且systemCode为1时选填，用于向移动端推送消息，后台管理系统及webapp忽略此参数
  final String? deviceToken;

  LoginDto({
    required this.userName,
    required this.password,
    required this.systemCode,
    this.from,
    this.deviceToken,
  });

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['userName'] = userName;
    data['password'] = password;
    data['systemCode'] = systemCode;
    if (from != null) data['from'] = from;
    if (deviceToken != null) data['deviceToken'] = deviceToken;
    return data;
  }

  factory LoginDto.fromJson(Map<String, dynamic> json) {
    return LoginDto(
      userName: json['userName'],
      password: json['password'],
      systemCode: json['systemCode'],
      from: json['from'],
      deviceToken: json['deviceToken'],
    );
  }
}